char buf[121];
sprintf(buf,
- "%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x",
+ "%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x",
bswab32(regs->eax),
bswab32(regs->ecx),
bswab32(regs->edx),
bswab32(regs->eflags),
bswab32(regs->cs),
bswab32(regs->ss),
+ bswab32(regs->ds),
bswab32(regs->es),
bswab32(regs->fs),
bswab32(regs->gs));
if (xdb_ctx.serhnd < 0) {
dbg_printk("Debugger not ready yet.\n");
- return;
+ return 0;
}
/* We rely on our caller to ensure we're only on one processor
if (!atomic_dec_and_test(&xendbg_running)) {
printk("WARNING WARNING WARNING: Avoiding recursive xendbg.\n");
atomic_inc(&xendbg_running);
- return;
+ return 0;
}
smp_send_stop();
watchdog_on = old_watchdog;
atomic_inc(&xendbg_running);
local_irq_restore(flags);
+ return 0;
}
static int
-.global cdb_trap
-.extern __trap_to_cdb
-
-#define SAVE_ALL_NOSEGREGS \
- pushw $0; \
- pushw %gs; \
- pushw $0; \
- pushw %fs; \
- pushw $0; \
- pushw %es; \
- pushw $0; \
- pushw %ds; \
- pushl %eax; \
- pushl %ebp; \
- pushl %edi; \
- pushl %esi; \
- pushl %edx; \
- pushl %ecx; \
- pushl %ebx;
+.global call_with_registers
- // Save the register state and call __trap_to_cdb
-cdb_trap:
- pushw $0
- pushw %ss
- pushl %esp //We'll fix this up later, in __trap_to_cdb, by adding 8
+#include <asm/asm-offsets.h>
+
+ // int call_with_registers(void (*f)(struct xen_regs *r)) ->
+ // build a xen_regs structure, and then call f with that.
+call_with_registers:
pushf
- pushw $0
- pushw %cs
- pushl 16(%esp)
-1: pushl $0 // Orig_eax
- SAVE_ALL_NOSEGREGS
+ subl $XREGS_user_sizeof, %esp
+ movl %ebx, XREGS_ebx(%esp)
+ movl %ecx, XREGS_ecx(%esp)
+ movl %edx, XREGS_edx(%esp)
+ movl %esi, XREGS_esi(%esp)
+ movl %edi, XREGS_edi(%esp)
+ movl %ebp, XREGS_ebp(%esp)
+ movl %eax, XREGS_eax(%esp)
+ movw $0, XREGS_error_code(%esp)
+ movw $0, XREGS_entry_vector(%esp)
+ movl XREGS_user_sizeof+4(%esp), %eax
+ movl %eax, XREGS_eip(%esp)
+ movl %cs, XREGS_cs(%esp)
+ movl XREGS_user_sizeof(%esp), %eax
+ movl %eax, XREGS_eflags(%esp)
+ movl %esp, XREGS_esp(%esp)
+ addl $XREGS_user_sizeof+4, XREGS_esp(%esp)
+ movl %ss, XREGS_ss(%esp)
+ movl %es, XREGS_es(%esp)
+ movl %ds, XREGS_ds(%esp)
+ movl %fs, XREGS_fs(%esp)
+ movl %gs, XREGS_gs(%esp)
+
+ movl XREGS_user_sizeof+8(%esp), %eax
pushl %esp
- call __trap_to_cdb
- add $72, %esp
- xorl %eax, %eax
+ call *%eax
+ add $XREGS_user_sizeof + 8, %esp
ret
#define DEBUGGER_trap_fatal(_v, _r) \
if ( debugger_trap_fatal(_v, _r) ) return EXCRET_fault_fixed;
+int call_with_registers(int (*f)(struct xen_regs *r));
+
#ifdef XEN_DEBUGGER
#include <asm/pdb.h>
#elif defined(CRASH_DEBUG)
-extern void cdb_trap(void);
-extern void __trap_to_cdb(struct xen_regs *);
+extern int __trap_to_cdb(struct xen_regs *r);
#define debugger_trap_entry(_v, _r) (0)
-#define debugger_trap_fatal(_v, _r) (__trap_to_cdb(_r), 0)
-#define debugger_trap_immediate() (cdb_trap())
+#define debugger_trap_fatal(_v, _r) __trap_to_cdb(_r)
+#define debugger_trap_immediate() call_with_registers(__trap_to_cdb)
#elif 0